package WaiBao;

import java.util.Arrays;

public class ChenLi {
    public static void main(String[] args) {
        String[] name = {"蓝精灵(班长)", "小黄人(副班长)", "小李(学习委员)", "杜甫(纪律委员)", "李贺(体育委员)", "欧阳修", "寒武", "敖丙", "大话", "倪大红", "杨水水", "火爆",
                "一线天", "戴工", "倪尚伟", "周星驰", "周润发", "刘德华", "刘梦", "孙紫薇", "唐新宇", "里大多", "卫青", "文丑", "阎良", "司马懿", "权志龙", "李荣浩",
                "那英", "程丽(学生)"};//最后一位考生本人: 程丽(学生)
        int[] age = {18, 19, 20, 21, 22, 21, 21, 21, 19, 19, 18, 18, 18, 20, 20, 19, 18, 18, 18, 18, 19, 19, 20, 20, 20, 18, 19, 19, 18, 20};//考生年龄：20岁

        double[]  huohuo1 = {91, 84, 90, 84, 91, 84, 77, 79, 89, 90, 90, 87, 85, 79, 65, 68, 69, 99, 96, 88, 92, 91, 95, 88, 75, 74, 78, 74, 80, 96};
        double[]  huohuo2 = {78, 84, 75, 74, 97, 81, 91, 84, 94, 77, 90, 77, 86, 75, 65, 65, 86, 79, 66, 68, 92, 71, 95, 85, 75, 84, 79, 64, 90, 96};
        double[]  huohuo3 = {73, 91, 90, 94, 74, 69, 76, 77, 85, 60, 94, 87, 85, 75, 65, 68, 69, 69, 96, 93, 92, 81, 95, 95, 79, 84, 77, 71, 89, 96};


        double  coco;//代表每个学生的总分
        double guming;//代表每个学生的平均分
//        for (int i = 0; i < 30; i++) {
//            coco = (huohuo1)[i] + huohuo2[i] +huohuo3[i];
//            guming  = ( coco * 1.0) / 3;
//            System.out.println(name[i] + "的总分为:" + coco);
//            System.out.println(name[i] + "的平均分为:" + guming);
//        }



        double gugu = 0, lala = 0;
        double[] oo = new double[30];
//        for (int i = 0; i < 30; i++) {
//            gugu = huohuo1[i] +  huohuo2[i] + huohuo3[i];
//            lala = ( gugu * 1.0) / 3;
//            oo[i] = lala ;
//        }
//
//        for (int i = 0; i <oo.length - 1; i++) {
//            for (int j = 0; j < oo.length - i - 1; j++) {
//                if (oo[j] < oo[j + 1]) {
//                    double tep = oo[j];
//                    oo[j] = oo[j + 1];
//                    oo[j + 1] = tep;
//                }
//            }
//        }
//        System.out.println("前十名同学的成绩为:");
//        for (int i = 0; i < 10; i++) {
//            System.out.println(oo[i]);
//        }
//



        double roll1 = 0, roll2 = 0,roll3 = 0;//计算每门课的平均分
        double deem1 = 0,deem2 = 0 ,deem3 = 0;//计算每门课标准差
        double logo1 = 0,logo2 = 0,logo3 = 0;//计算每门课中位数
        double sum2 = 0;
        for (int i = 0; i < huohuo1.length; i++) {
            sum2+=huohuo1[i];
        }
        roll1 = (sum2*1.0)/30;
        System.out.println("生物化学的班级平均分为:"+roll1);
        double Sum = 0;
        for (int i = 0; i < huohuo2.length; i++) {
            Sum+=huohuo2[i];
        }
        roll2 = (Sum*1.0)/30;
        System.out.println("物理化学的班级平均分为:"+roll2);
        double sum = 0;
        for (int i = 0; i <huohuo3.length; i++) {
            sum+=huohuo3[i];
        }
        roll3 = (sum*1.0)/30;
        System.out.println("电子与电工技术的班级平均分为:"+ roll3);


////////
        double he1 = 0,he2 = 0,he3 = 0;
        for (int i = 0; i <huohuo1.length; i++) {
            he1+= (huohuo1[i] - roll1)*(huohuo1[i] - roll1);
        }
        deem1 = Math.sqrt(he1*1.0/30);
        System.out.println("生物化学的班级标准差为:"+ deem1);

        for (int i = 0; i <huohuo2.length; i++) {
            he2+= (huohuo2[i] - roll2)*(huohuo2[i] -roll2);
        }
        deem2 = Math.sqrt(he2*1.0/30);
        System.out.println("物理化学的班级标准差为:"+ deem2);

        for (int i = 0; i < huohuo3.length; i++) {
            he3+= (huohuo3[i] -roll3)*(huohuo3[i] -  roll3);
        }
        deem3 = Math.sqrt(he3*1.0/30);
        System.out.println("电子与电工的班级标准差为:"+ deem3);
//

//        Arrays.sort(huohuo1);
//        Arrays.sort(huohuo2);
//        Arrays.sort(huohuo3);
//        logo1 =(huohuo1[14]+huohuo1[15])*1.0/2;
//        logo2 =(huohuo2[14]+huohuo2[15])*1.0/2;
//        logo3 =( huohuo3[14]+huohuo3[15])*1.0/2;
//        System.out.println("生物化学的中位数为:"+logo1);
//        System.out.println("物理化学的中位数为:"+logo2);
//        System.out.println("电子与电工的中位数为:"+logo3);


    }
}
